﻿using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using Network;
using Providers.FileTransfer.Server;

namespace Managers.FileTransfer.Server
{
   public sealed class FileTransferSeverManager:Manager<FileTransferServerProvider>
    {
       public FileTransferSeverManager(NetworkPeer network) : base(new FileTransferServerProvider(network))
       {
       }

       public void NotifyNewFileCanCopy(List<string> dirList, List<string> fileList)
       {
           Provider.NotifyNewFileCanCopy(dirList,fileList);
       }

        public void NotifyNewFileCanCopy(StringCollection stringCollection)
        {
            List<string> dirList =new List<string>();
            List<string> fileList = new List<string>();
            foreach (var strDropFile in stringCollection)
            {
                //判断其它远程系统写剪贴板的情况。
                if (!strDropFile.Contains(":"))
                {
                    continue;
                }
                if (Directory.Exists(strDropFile))
                {
                    dirList.Add(strDropFile);
                }
                else if (File.Exists(strDropFile))
                {
                    fileList.Add(strDropFile);
                }
            }
            Provider.NotifyNewFileCanCopy(dirList,fileList);
        }

       public void NotifyNewTextCanCopy(string getText)
       {
           if (!string.IsNullOrEmpty(getText))
           {
            Provider.NotifyNewTextCanCopy(getText);

            }
        }
    }
}
